﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Supplier/SupplierMasterPage.master"
    AutoEventWireup="true" CodeFile="PriceOnDays.aspx.cs" Inherits="Supplier_Price_PriceOnDays" %>

<asp:Content ID="Content2" ContentPlaceHolderID="pnlMain" runat="Server">
    <table cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <table cellpadding="3" cellspacing="3">
                    <tr>
                        <td id="tdSupplierHead" runat="server">
                            
                        </td>
                    </tr>
                    <tr>
                        <td id="tdSupplierControl" runat="server">
                           Supplier:&nbsp;<asp:DropDownList ID="ddlSuppliers" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlSuppliers_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                          Location:&nbsp;<asp:DropDownList ID="ddlLocations" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlLocations_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>
                    </tr>
                   
                    <tr>
                        <td>
                           Vehicle:&nbsp;&nbsp;&nbsp;<asp:DropDownList ID="ddlVehicles" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlVehicles_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>
                    </tr>
                    
                    <tr>
                        <td>
                          Season:&nbsp;&nbsp;&nbsp;<asp:DropDownList ID="ddlSeasons" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddlSeasons_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Panel ID="pnlPriceOnDays" runat="server">
                    <asp:Literal ID="ltrMessage" runat="server"></asp:Literal>
                    <table cellpadding="0" cellspacing="0">
                        <colgroup>
                            <col width="100" />
                            <col width="600" />
                            <tr>
                                <td colspan="2">
                                    <h3>
                                        Add New</h3>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Start Days
                                </td>
                                <td>
                                    <asp:TextBox ID="txtStartDayAdd" runat="server" MaxLength="2" Width="100"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvStartDayAdd" runat="server" ControlToValidate="txtStartDayAdd"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="VGADD"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="revStartDayAdd" runat="server" ControlToValidate="txtStartDayAdd"
                                        Display="Dynamic" ErrorMessage="Invalid Days" ValidationExpression="\d*"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    End Days
                                </td>
                                <td>
                                    <asp:TextBox ID="txtEndDayAdd" runat="server" MaxLength="3" Width="100"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="rfvEndDayAdd" runat="server" ControlToValidate="txtEndDayAdd"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="VGADD"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtEndDayAdd"
                                        Display="Dynamic" ErrorMessage="Invalid Days" ValidationExpression="\d*"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Rent Price
                                </td>
                                <td>
                                    <asp:TextBox ID="txtRentPriceAdd" runat="server" MaxLength="5" Width="100"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtRentPriceAdd"
                                        Display="Dynamic" ErrorMessage="*" ValidationGroup="VGADD"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtRentPriceAdd"
                                        Display="Dynamic" ErrorMessage="Invalid Value" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                        ValidationGroup="VGADD"></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr id="trPercentMargin" runat="server">
                            <td>
                                % Margin
                            </td>
                            <td>
                                <asp:TextBox ID="txtPercentMarginAdd" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator1SellPriceAdd" ControlToValidate="txtPercentMarginAdd"
                                    ValidationGroup="VGADD" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                        ID="RegularExpressionValidator1PercentMarginAdd" runat="server" ErrorMessage="Invalid Value"
                                        ControlToValidate="txtPercentMarginAdd" ValidationGroup="VGDD" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                        Display="Dynamic"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                         <tr id="trActualMargin" runat="server" >
                            <td>
                                Actual Margin
                            </td>
                            <td>
                                <asp:TextBox ID="txtActualMarginAdd" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                    ID="RequiredFieldValidator2" ControlToValidate="txtActualMarginAdd"
                                    ValidationGroup="VGADD" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                        ID="RegularExpressionValidator1ActualMarginAdd" runat="server" ErrorMessage="Invalid Value"
                                        ControlToValidate="txtActualMarginAdd" ValidationGroup="VGDD" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                        Display="Dynamic"></asp:RegularExpressionValidator>
                            </td>
                        </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Add" ValidationGroup="VGADD" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    &nbsp;
                                </td>
                            </tr>
                        </colgroup>
                    </table>
                    <asp:GridView ID="gvPriceOnDays" runat="server" AutoGenerateColumns="False" DataKeyNames="PriceOnDaysId"
                        EmptyDataText="There are no data records to display." OnRowCancelingEdit="gvPriceOnDays_RowCancelingEdit"
                        OnRowDataBound="gvPriceOnDays_RowDataBound" OnRowDeleted="gvPriceOnDays_RowDeleted"
                        OnRowDeleting="gvPriceOnDays_RowDeleting" OnRowEditing="gvPriceOnDays_RowEditing"
                        OnRowUpdated="gvPriceOnDays_RowUpdated" OnRowUpdating="gvPriceOnDays_RowUpdating">
                        <Columns>
                            <asp:TemplateField HeaderText="Start Days">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtStartDaysEdit" runat="server" MaxLength="3" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="rfvStartDaysEdit" ControlToValidate="txtStartDaysEdit" ValidationGroup="VGEDIT"
                                        runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="revStartDayEdit" runat="server" Display="Dynamic" ControlToValidate="txtStartDaysEdit"
                                            ErrorMessage="Invalid Days" ValidationExpression="\d*"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblStartDays" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="End Days">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtEndDaysEdit" runat="server" MaxLength="3" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="rfvEndDaysEdit" ControlToValidate="txtEndDaysEdit" ValidationGroup="VGEDIT"
                                        runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="revEndDayEdit" runat="server" Display="Dynamic" ControlToValidate="txtEndDaysEdit"
                                            ErrorMessage="Invalid Days" ValidationExpression="\d*"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblEndDays" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Rent Price">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtRentPriceEdit" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="RequiredFieldValidator1" ControlToValidate="txtRentPriceEdit" ValidationGroup="VGEDIT"
                                        runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid Value"
                                            ControlToValidate="txtRentPriceEdit" ValidationGroup="VGEDIT" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                            Display="Dynamic"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblRentPrice" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="% Margin">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtPercentMarginEdit" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="RequiredFieldValidator1PercentMarginEdit" ControlToValidate="txtPercentMarginEdit"
                                        ValidationGroup="VGEDIT" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="RegularExpressionValidator1PercentMarginEdit" runat="server" ErrorMessage="Invalid Value"
                                            ControlToValidate="txtPercentMarginEdit" ValidationGroup="VGEDIT" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                            Display="Dynamic"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblPercentMargin" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Actual Margin">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtActualMarginEdit" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="RequiredFieldValidator1ActualMarginEdit" ControlToValidate="txtActualMarginEdit"
                                        ValidationGroup="VGEDIT" runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="RegularExpressionValidator1ActualMarginEdit" runat="server" ErrorMessage="Invalid Value"
                                            ControlToValidate="txtActualMarginEdit" ValidationGroup="VGEDIT" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                            Display="Dynamic"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblActualMargin" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkEdit" CausesValidation="false" CommandName="Edit" runat="server"
                                        Text="Edit"></asp:LinkButton>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:LinkButton ID="lnkSave" CausesValidation="true" runat="server" CommandName="Update"
                                        ValidationGroup="VGEDIT" Text="Update"></asp:LinkButton>
                                    &nbsp
                                    <asp:LinkButton ID="lnkCancel" CausesValidation="false" runat="server" CommandName="Cancel"
                                        Text="Cancel"></asp:LinkButton>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowDeleteButton="True" />
                        </Columns>
                    </asp:GridView>
                    
                    <asp:GridView ID="gvSuppPriceOnDays" runat="server" AutoGenerateColumns="False" DataKeyNames="PriceOnDaysId"
                        EmptyDataText="There are no data records to display." OnRowCancelingEdit="gvSuppPriceOnDays_RowCancelingEdit"
                        OnRowDataBound="gvSuppPriceOnDays_RowDataBound" OnRowDeleted="gvSuppPriceOnDays_RowDeleted"
                        OnRowDeleting="gvSuppPriceOnDays_RowDeleting" OnRowEditing="gvSuppPriceOnDays_RowEditing"
                        OnRowUpdated="gvSuppPriceOnDays_RowUpdated" OnRowUpdating="gvSuppPriceOnDays_RowUpdating">
                        <Columns>
                            <asp:TemplateField HeaderText="Start Days">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtStartDaysEdit" runat="server" MaxLength="3" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="rfvStartDaysEdit" ControlToValidate="txtStartDaysEdit" ValidationGroup="VGEDIT"
                                        runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="revStartDayEdit" runat="server" Display="Dynamic" ControlToValidate="txtStartDaysEdit"
                                            ErrorMessage="Invalid Days" ValidationExpression="\d*"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblStartDays" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="End Days">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtEndDaysEdit" runat="server" MaxLength="3" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="rfvEndDaysEdit" ControlToValidate="txtEndDaysEdit" ValidationGroup="VGEDIT"
                                        runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="revEndDayEdit" runat="server" Display="Dynamic" ControlToValidate="txtEndDaysEdit"
                                            ErrorMessage="Invalid Days" ValidationExpression="\d*"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblEndDays" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Rent Price">
                                <EditItemTemplate>
                                    <asp:TextBox ID="txtRentPriceEdit" runat="server" MaxLength="5" Width="100"></asp:TextBox><asp:RequiredFieldValidator
                                        ID="RequiredFieldValidator1" ControlToValidate="txtRentPriceEdit" ValidationGroup="VGEDIT"
                                        runat="server" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator><asp:RegularExpressionValidator
                                            ID="RegularExpressionValidator1" runat="server" ErrorMessage="Invalid Value"
                                            ControlToValidate="txtRentPriceEdit" ValidationGroup="VGEDIT" ValidationExpression="\d{1,2}(?:\.\d{1,2})?$"
                                            Display="Dynamic"></asp:RegularExpressionValidator>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="lblRentPrice" runat="server"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkEdit" CausesValidation="false" CommandName="Edit" runat="server"
                                        Text="Edit"></asp:LinkButton>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:LinkButton ID="lnkSave" CausesValidation="true" runat="server" CommandName="Update"
                                        ValidationGroup="VGEDIT" Text="Update"></asp:LinkButton>
                                    &nbsp
                                    <asp:LinkButton ID="lnkCancel" CausesValidation="false" runat="server" CommandName="Cancel"
                                        Text="Cancel"></asp:LinkButton>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowDeleteButton="True" />
                        </Columns>
                    </asp:GridView>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
